#ifndef FORM_INPUT_H
#define FORM_INPUT_H

#include <QWidget>
#include <QSqlQuery>
#include <QSqlQueryModel>
#include <QTimer>

namespace Ui {
class Form_input;
}

class Form_input : public QWidget
{
    Q_OBJECT

public:
    explicit Form_input(QWidget *parent = nullptr);
    ~Form_input();
    void closeEvent(QCloseEvent *event);

    bool input(QString mode);
signals:
    //void destroyW( Form_input * );
    void destroyW( QString );

private slots:
    void clearDrugList();
    void listItems(QString);
    void on_leSearch_textChanged(QString);
    void on_tvList_clicked(const QModelIndex &index);
    void on_tbAdd_clicked();
    //void on_lwList_clicked(const QModelIndex &index);
    void on_pbClear_clicked();
    //void timerTimeOut();
    void tmrTimeout();
    void tmrDisplayTimeout();
    void on_pbSave_clicked();
    void on_tbExit_clicked();

    void on_pushButton_clicked();

    void on_tbOutMM_clicked();
    void on_tbInMM_clicked();
    void on_tbOutCash_clicked();
    void on_tbInCash_clicked();

    void on_toolButton_clicked();

    void on_lwList_clicked(const QModelIndex &index);

    void on_leSearch_returnPressed();

    void on_cbbReceiver_currentIndexChanged(const QString &arg1);

    void on_leSum_returnPressed();

private:
    Ui::Form_input *ui;
    QSqlQuery *qr;
    QSqlQuery *qr0;
    QSqlQueryModel *md;
    QMap < QString, QString > mp;
    QList<QMap<QString, QString>> drugList;

    QTimer *tmr;
    QTimer * tmrItemDisplay;
    int itemLength;
    QString inWay, outWay;
    int amountValue, inCash, inMM, outCash, outMM ;
    bool saveData(QString mode);
    int listWidgetRowNum;
};

#endif // FORM_INPUT_H
